package com.management.department.teacherinfosystem.Entity;

import java.time.LocalDateTime;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import lombok.Getter;
import lombok.Setter;

@Entity
@Table(name = "activity_attachments")
@Getter
@Setter
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
public class ActivityAttachment {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Column(nullable = false, length = 255)
    private String fileName; // 文件名

    @Column(nullable = false, length = 500)
    private String filePath; // 文件路径

    @Column(nullable = false, length = 100)
    private String fileType; // 文件类型（会议通知、参会证明、邀请函、报告PPT等）

    @Column(nullable = false)
    private Long fileSize; // 文件大小

    @Column(length = 100)
    private String contentType; // MIME类型

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "activity_id", nullable = false)
    @JsonIgnore
    private Activity activity;

    @Column(nullable = false)
    private LocalDateTime uploadTime = LocalDateTime.now();
} 